<template>
  <div class="parent">
    <el-dropdown trigger="click" >
      <span class="el-dropdown-link">
        <span style="color: #fff">设置</span><i class="el-icon-arrow-down el-icon--right" style="color: #fff"></i>
      </span>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item>
          <el-dropdown>
            <span>个人中心</span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item>
                用户名: {{userName}}
              </el-dropdown-item>
              <el-dropdown-item>
                密码: {{password}}
              </el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-dropdown-item>
        <el-dropdown-item><span @click="loginOut">退出</span></el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
  </div>
</template>
<script>
export default {
  name: 'headerCont',
  data () {
    return {
      userName: '',
      password: ''
    }
  },
  created () {
    let userInfo = JSON.parse(sessionStorage.getItem('userInfo'))
    this.userName = userInfo.userName
    this.password = userInfo.password
  },
  methods: {
    loginOut () {
      this.$router.push({
        path: '/Login'
      })
      sessionStorage.removeItem('userInfo')
    }
  }
}
</script>
<style scoped lang="less">

</style>
